/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package updateGaji;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import Karyawan.Karyawan;
import hitunggaji.Gaji;

/**
 *
 * @author yolan
 */
public class updategajitabelmodel extends AbstractTableModel{

    private ArrayList<Gaji> stok = new ArrayList<Gaji>();

    public updategajitabelmodel(List<Gaji> stk) {
        this.stok = (ArrayList<Gaji>) stk;
    }

    @Override
    public int getColumnCount() {
        return 3; 
    }

    @Override
    public int getRowCount() {
        return stok.size();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Gaji br = stok.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return br.getGolongan().getGolongan();
            case 1:
                return br.getGajigolongan();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "Golongan";
            case 1:
                return "Gaji Golongan";
            default:
                return " ";
        }
    }
}
